package com.heima.feign.schedule;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.schedule.dtos.TaskDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient("leadnews-schedule")
public interface IScheduleClient {

    /**
     * 添加任务到延迟队列
     * @param taskDto
     * @return
     */
    @PostMapping("/api/v1/task/add")
    public ResponseResult addTask(@RequestBody TaskDto taskDto);

    /**
     * 取消任务
     * @param taskId
     * @return
     */
    @GetMapping("/api/v1/task/{taskId}")
    public ResponseResult cancelTask(@PathVariable Long taskId);

    /**
     * 消费任务
     * @param taskType
     * @param priority
     * @return
     */
    @GetMapping("/api/v1/task/{taskType}/{priority}")
    public ResponseResult popTask(@PathVariable Integer taskType,@PathVariable Integer priority);
}
